<template>
  <div class="pl-24">
    <div class="mb-12">
        <el-checkbox v-model="item.checked" class="mb-12">{{item.name}}</el-checkbox>
    </div>
    <template v-if="hasChild(item.children)">
      <select-item v-for="(child, index) in item.children" :item='child' :key="index" />
    </template>
  </div>
</template>
<script>
export default {
    name: 'SelectItem',
    data(){
        return{}
    },
    props: {
      item: {
        type: Object,
        required: true
      },
    },
    methods:{
      hasChild(children = []){
        if(!children){
          children = []
        }
        if(children.length){
            return true
        }else{
            return false
        }
      }
    }
}
</script>